﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel.DataAnnotations;

namespace TestCustomControls
{
    [DefaultProperty("")]
    [ToolboxData("<{0}:CustomLabel runat=server></{0}>")]
    public class CustomLabel : WebControl
    {

        public CustomLabel()
        {
        }

        public string Link
        {
            get
            {
                return ViewState["Link"] == null ? "boş" : ViewState["Link"] as string;
            }
            set
            {
                ViewState["Link"] = value;
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
         
        }

        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
            writer.Write(this.Link);
            ClientScriptManager manager = Page.ClientScript;
            //debugger; $(document).ready($('#" + this.ClientID + "').on('click',function(){alert('" + this.Link + "')}));
            manager.RegisterClientScriptBlock(this.GetType(), "OnClick", "<script>debugger; $(document).ready(function(){$('#" + this.ClientID + "').hide();});</script>");

        }

    }
}
